public class Demo8 {
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("hello thread!");
        });

        //允许主线程（main thread）在执行完毕后，JVM 可以直接退出，而无需等待后台线程 thread 执行完成
        thread.setDaemon(true);
        thread.start();

    }
}
